<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var frutis = ["apple", "orange", "banana"];
        var frutis2 = ["荔枝","桃子","榴莲"];
        
        var frutisAll = frutis.concat(frutis2);
        console.log(frutis);
        console.log(frutis2);
        console.log(frutisAll);

        // 移除并返回最后一个元素
        var res = frutisAll.pop();
        console.log(res);

        // 从尾端增加元素并返回长度
        var len = frutisAll.push("葡萄");
        console.log(len);
        console.log(frutisAll);

        frutisAll[6] = "orange";
        
        // 查找 orange
        var index1 = frutisAll.indexOf("orange");
        var index2 = frutisAll.lastIndexOf("orange");
        console.log(index1);
        console.log(index2);

        console.log(frutisAll);
        // 反转数组
        frutisAll.reverse();
        console.log(frutisAll);

        // 转换成字符串
        console.log(frutisAll.join("-"));

        console.log(frutisAll);
        // 截取数据
        console.log(frutisAll.slice(2,5));

        console.log(frutisAll);
        // 删除或增加数据
        frutisAll.splice(2,2,"ele1","ele2","ele3");
        console.log(frutisAll);
    </script>
</head>
<body>
    
</body>
</html>